/**
 * 获取文件后缀
 * @param {String} fileName
 * @return {String}
 */
export function getFileSuffix(fileName) {
    return fileName.slice(fileName.lastIndexOf(".") + 1, fileName.length);
}

/**
 * 对象转为fromData
 * @param {Object} obj
 * @param {FormData} formdata
 * @return {FormData}
 */
export function objToFormData(obj, formdata) {
    const fd = formdata || new FormData();
    for (const key in obj) {
        if (obj.hasOwnProperty(key)) {
            const element = obj[key];
            fd.append(key, element);
        }
    }
    return fd;
}
